package com.liugan.magic.utils;

import org.loon.framework.android.game.action.sprite.Animation;
import org.loon.framework.android.game.core.LSystem;
import org.loon.framework.android.game.core.graphics.opengl.LTexture;

import com.liugan.magic.Constants;

public class AnimationUtils {

	//动画集
	
	//人物
	//面向左方向的动画
	public Animation leftstandanimation;
	//面向右方向的动画
	public Animation rightstandanimation;
	//向左行走的动画
	public Animation leftrunanimation;
	//向右行走的动画
	public Animation rightrunanimation;
	//跳的动画   面向右
	public Animation jumpanimation;
	//跳的动画   面向左
	public Animation jumpanimation_left;
	
	//蝴蝶的
	public Animation butterflya;
	
	//1 兔子
		//兔子站立 面向右边
	public Animation rrsa;
		//兔子站立面向左边
	public Animation rlsa;
		//兔子向右边运行
	public Animation rrra;
		//兔子向左边运动
	public Animation rlra;
	//兔子跳起来的图片
	public LTexture rrjump;
	public LTexture rljump;
	
	
	//2 青蛙
	//青蛙站立 面向右边
	public Animation frs;
		//青蛙站立面向左边
	public Animation fls;
		//青蛙向右边运行
	public Animation frr;
		//青蛙向左边运动
	public Animation flr;
	//青蛙跳起来的图片
	public LTexture frjump;
	public LTexture fljump;
	
	//3 狐狸
	//狐狸站立 面向右边
	public Animation ffrs;
		//狐狸站立面向左边
	public Animation ffls;
		//狐狸向右边运行
	public Animation ffrr;
		//狐狸向左边运动
	public Animation fflr;
	//狐狸跳起来的图片
	public LTexture ffrjump;
	public LTexture ffljump;
	
	
	//门
	public Animation doora;
	public LTexture door;
	
	//变形
	public Animation transformer;
	
	//key
	public Animation key;
	
	//石头
	public LTexture stone;
	//单例
	private static AnimationUtils instance;
	private AnimationUtils(){
		
		//person
		leftstandanimation=Animation.getDefaultAnimation(Constants.imagespath + "person/mls.png", 115, 150, 150);
		rightstandanimation=Animation.getDefaultAnimation(Constants.imagespath + "person/mrs.png", 115, 150, 150);
		leftrunanimation=Animation.getDefaultAnimation(Constants.imagespath + "person/mlr.png", 115, 153, 100);
		rightrunanimation=Animation.getDefaultAnimation(Constants.imagespath + "person/mrr.png", 115, 153, 100);
		jumpanimation=Animation.getDefaultAnimation(Constants.imagespath + "person/mrj.png", 115, 150, 200);
		jumpanimation_left=Animation.getDefaultAnimation(Constants.imagespath + "person/mlj.png", 115, 150, 200);
		
		//蝴蝶
		butterflya=Animation.getDefaultAnimation(Constants.imagespath + "butterfly/butterfly.png", 28, 26, 100);
		
		//rabbit
		rrsa=Animation.getDefaultAnimation(Constants.imagespath + "rabbit/rrsa.png", 91, 61, 100);
		rlsa=Animation.getDefaultAnimation(Constants.imagespath + "rabbit/rlsa.png", 91, 61, 100);
		rrra=Animation.getDefaultAnimation(Constants.imagespath + "rabbit/rrra.png", 91, 61, 100);
		rlra=Animation.getDefaultAnimation(Constants.imagespath + "rabbit/rlra.png", 91, 61, 100);
		rrjump=rrra.getSpriteImage(1);
		rljump=rlra.getSpriteImage(1);
		//frog
		frs=Animation.getDefaultAnimation(Constants.imagespath + "frog/frs.png", 70, 125, 200);
		fls=Animation.getDefaultAnimation(Constants.imagespath + "frog/fls.png", 70, 125, 200);
		frr=Animation.getDefaultAnimation(Constants.imagespath + "frog/frr.png", 70, 125, 100);
		flr=Animation.getDefaultAnimation(Constants.imagespath + "frog/flr.png", 70, 125, 100);
		frjump=frr.getSpriteImage(1);
		fljump=flr.getSpriteImage(1);
		//fox
		ffrs=Animation.getDefaultAnimation(Constants.imagespath + "fox/frs.png", 132, 79, 100);
		ffls=Animation.getDefaultAnimation(Constants.imagespath + "fox/fls.png", 132, 79, 100);
		ffrr=Animation.getDefaultAnimation(Constants.imagespath + "fox/frr.png", 132, 76, 50);
		fflr=Animation.getDefaultAnimation(Constants.imagespath + "fox/flr.png", 132, 76, 50);
		ffrjump=ffrr.getSpriteImage(2);
		ffljump=fflr.getSpriteImage(2);
		//door
		doora=Animation.getDefaultAnimation(Constants.imagespath + "door/door.png", 230, 190, 300);
		door=doora.getSpriteImage(0);
		//trans
		transformer=Animation.getDefaultAnimation(Constants.imagespath + "other/transformer.png", 130, 182, 90);
		//key
		key=Animation.getDefaultAnimation(Constants.imagespath + "key/key.png", 60, 63, 200);
		//石头
		stone=new LTexture(Constants.imagespath + "stone/stone.png");
		LSystem.gc();
	}
	public synchronized static AnimationUtils getinstance(){
		if (instance==null){
			instance=new AnimationUtils();
		}
		return instance;
	}
	
	public synchronized void  destroy(){
		instance=null;
		LSystem.gc();
	}
}
